{extend name="public/basic"}
{block name="main"}
<form class = "layui-form" action="{:url('')}" method="get">
    <div class = "layui-col-xs3">
        <div class = "layui-form-item">
            <label class = "layui-form-label">注册时间起</label>
            <div class = "layui-input-block">
                <input type="text" class = "layui-input layui-date" autocomplete="off" name="start" value = "{$where['start']|default=''}"/>
            </div>
        </div>
    </div>
    <div class = "layui-col-xs3">
        <div class = "layui-form-item">
            <label class = "layui-form-label">注册时间止</label>
            <div class = "layui-input-block">
                <input type="text" class = "layui-input layui-date" autocomplete="off" name="end" value = "{$where['end']|default=''}"/>
            </div>
        </div>
    </div>
    <div class = "layui-col-xs3">
        <div class = "layui-form-item">
            <label class = "layui-form-label">用户名</label>
            <div class = "layui-input-block">
                <input type="text" class = "layui-input" name="username" autocomplete="off" value = "{$where['username']|default=''}"/>
            </div>
        </div>
    </div>
    <div class = "layui-col-xs3">
        <div class = "layui-form-item">
            <label class = "layui-form-label">邮箱</label>
            <div class = "layui-input-block">
                <input type="text" class = "layui-input" name="email" autocomplete="off" value = "{$where['email']|default=''}"/>
            </div>
        </div>
    </div>
    <div class = "layui-col-xs3">
        <div class = "layui-form-item">
            <label class = "layui-form-label">手机号</label>
            <div class = "layui-input-block">
                <input type="text" class = "layui-input" name="mobile" autocomplete="off" value = "{$where['mobile']|default=''}"/>
            </div>
        </div>
    </div>
    <div class = "layui-col-xs3">
        <div class = "layui-form-item">
            <label class = "layui-form-label">是否激活</label>
            <div class = "layui-input-block">
                <select name = "is_active">
                    <option value = ''>是否激活</option>
                    <option value = "0" {if condition="isset($where['is_active']) && $where['is_active'] eq 0"}checked{/if}>否</option>
                    <option value = "1" {if condition="isset($where['is_active']) && $where['is_active'] eq 1"}checked{/if}>是</option>
                </select>
            </div>
        </div>
    </div>
    <div class = "layui-col-xs3">
        <div class = "layui-form-item">
            <label class = "layui-form-label">是否有效</label>
            <div class = "layui-input-block">
                <select name = "status">
                    <option value = ''>是否有效</option>
                    <option value = "0" {if condition="isset($where['status']) && $where['status'] eq 0"}checked{/if}>否</option>
                    <option value = "1" {if condition="isset($where['status']) && $where['status'] eq 1"}checked{/if}>是</option>
                </select>
            </div>
        </div>
    </div>
    <div class = "layui-row">
        <button class = "layui-btn layui-btn-success" type="submit">查询</button>
    </div>
</form>
{php}$yes_or_no = ['否','是'];{/php}
<table class = "layui-table">
    <thead>
        <tr>
            <th>用户名</th>
            <th>手机</th>
            <th>邮箱</th>
            <th>注册时间</th>
            <th>是否激活</th>
            <th>注册IP</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        {volist name="records" id="vo"}
            <tr>
                <td>{$vo.username}</td>
                <td>{$vo.mobile}</td>
                <td>{$vo.email}</td>
                <td>{:date('Y-m-d H:i:s',$vo.reg_time)}</td>
                <td>{$yes_or_no[$vo.is_active]}</td>
                <td>{$vo.reg_ip|long2ip}</td>
                <td>{$yes_or_no[$vo.status]}</td>
                <td>
                    {auth:button rules="$buttons" rule="home/merchant/del"}<i class = "layui-icon layui-icon-delete" action="del" action-url="{:url('del',['id'=>$vo['id']])}"></i>{/auth:button}
                    {auth:button rules="$buttons" rule="home/merchant/status"}<i class = "layui-icon layui-icon-vercode" action="ajax" action-url="{:url('status',['id'=>$vo['id'],'status'=>$vo['status']])}" action-ask="{if condition='$vo["status"] eq 0'}确定要启用该商户吗？{else/}确定要禁用该商户？{/if}"></i>{/auth:button}
                    {auth:button rules="$buttons" rule="home/merchant/auth"}<i class = "layui-icon layui-icon-set-fill" action = "dialog" action-url = "{:url('auth',['id'=>$vo['id']])}" title = "权限分配"></i>{/auth:button}
                </td>
            </tr>
        {/volist}
    </tbody>
</table>
{$records->render()}
{/block}